package main

import "strings"

func areSentencesSimilar(sentence1 string, sentence2 string) bool {
	words1 := strings.Split(sentence1, " ")
	words2 := strings.Split(sentence2, " ")
	i := 0
	for i < len(words1) && i < len(words2) && words1[i] == words2[i] {
		i++
	}
	j := 0
	for j < len(words1)-i && j < len(words2)-i &&
		words1[len(words1)-j-1] == words2[len(words2)-j-1] {
		j++
	}

	return i+j == len(words1) || i+j == len(words2)
}

func main() {

}
